<script setup>
import {uploadUrl} from "../config/Config.js";
const props = defineProps({
  imgSrc:{
    type:String,
    default:null
  }
})
const emit = defineEmits(['onUploadSuccess'])
const onSuccess = (res)=>{
  emit('onUploadSuccess',res)
}

</script>
<template>
  <el-upload
      :action="uploadUrl()"
      :show-file-list="false"
      :on-success="onSuccess"
  >
    <el-icon   v-if="!props.imgSrc" class="avatar-uploader-icon"><Plus /></el-icon>
    <img v-else class="avatar-uploader-icon" :src="props.imgSrc" alt=""/>
  </el-upload>
</template>



<style scoped lang="less">
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  text-align: center;
  border: 1px dashed var(--el-border-color);
}
</style>